// 测试 setTimeout 函数

// handler 用于指定要完成的操作(通常是个函数)
// timeout 用于指定多少毫秒后开始执行handler中的操作
// setTimeout( handler , timeout );

let handler = function(){
    console.log( new Date().toLocaleString() )
}

let timeout = 1000 ;
// 在 1000ms 后开始 test 函数中的操作
setTimeout( handler , timeout );
console.log( 'hahaha: ' + new Date().toLocaleString() );


function add( a , b ) {
    let c = a + b ;
    console.log( `${a} + ${b} = ${c}` );
}

let timer = setTimeout( add , 3000 , 10 , 20 );
console.log( timer );

let showTime = function(){
    let now = new Date();
    let year = now.getFullYear();
    let month = now.getMonth() + 1 ;// 鬼子那边月份从零开始
    let date = now.getDate();
    let hours = now.getHours();
    let minutes = now.getMinutes();
    let seconds = now.getSeconds();
    let ms = now.getMilliseconds();
    console.log( `${year}年${month}月${date}日 ${hours}:${minutes}:${seconds}.${ms}` );
}

timer = setInterval( showTime , 1000 );
console.log( timer );